//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.dstz.bpm.engine.action.handler.task;

import com.dstz.base.api.exception.BusinessMessage;
import com.dstz.bpm.api.constant.ActionType;
import com.dstz.bpm.api.constant.TaskStatus;
import com.dstz.bpm.core.model.BpmTask;
import com.dstz.bpm.engine.action.cmd.DefualtTaskActionCmd;
import com.dstz.sys.util.ContextUtil;
import org.springframework.stereotype.Component;

@Component
public class TaskLockActionHandler extends AbstractTaskActionHandler<DefualtTaskActionCmd> {
   public TaskLockActionHandler() {
   }

   @Override
   public ActionType getActionType() {
      return ActionType.LOCK;
   }

   @Override
   public void execute(DefualtTaskActionCmd model) {
     // this.f(model);
      this.l(model);
      BpmTask task = (BpmTask)model.getBpmTask();
      if (!task.getAssigneeId().equals("0")) {
         throw new BusinessMessage("该任务只有一个候选人没有锁定的必要。");
      } else {
         task.setAssigneeId(ContextUtil.getCurrentUserId());
         task.setAssigneeNames(ContextUtil.getCurrentUser().getFullname());
         task.setStatus(TaskStatus.LOCK.getKey());
         this.aJ.update(task);
      }
   }

   @Override
   protected void b(DefualtTaskActionCmd var1) {

   }


   public void g(DefualtTaskActionCmd actionModel) {
   }

   public int getSn() {
      return 6;
   }

   public Boolean isDefault() {
      return false;
   }

   @Override
   public String getDefaultGroovyScript() {
      return "return task.getAssigneeId().equals(\"0\")";
   }

   public String getConfigPage() {
      return "";
   }
}
